<?php

// ڶתorderϢļ¼
// from => webshop.acuityworld.com/jump_pay.php
// target => $paymentBOX['proxyURL'] .'http://'. $paymentBOX['mydomain'].$paymentBOX['path'] . "paymentpayment.php";

require_once './include/common.inc.php';
include_once './include/cart.class.php';

$page_title = 'Acuity World WebShop';



$uid = $_POST['uid'];

$user_street = $_POST['user_street'];
$user_city = $_POST['user_city'];
$user_zip = $_POST['user_zip'];
$user_state = $_POST['user_state'];
$user_country = $_POST['user_country'];

$pay_type = 'creditcard';
$card_name = $_POST['card_name'];
$card_number = $_POST['card_number'];
$card_type = $_POST['card_type'];
$card_emonth = $_POST['card_emonth'];
$card_eyear = $_POST['card_eyear'];
$card_date = $card_emonth . "/" . $card_eyear;
$card_cvc = $_POST['card_cvc'];

//$card_date2 = '';
//$card_cvc2 = '';
////$card_number2 = substr($card_number, -4); 
//$card_number2 = $card_number;

$cart = new cart();
$cart_info = getCartInfo($uid);
if (!$cart = unserialize($cart_info)) {
    $cart = new cart();
}

$promoter_id = $cart->getPromoterId();
$country_id = $cart->getCountry();
$cost = $cart->getTotalCost2();

//before pay set pay_flag=-1
$sql = "INSERT INTO `cus_order` (`user_id` , `promoter_id` , `country_id` , `cost` , `d_street` , `d_city` , `d_state` , `d_zip` , `d_country` , `cart_info` , `pay_type` , `card_name` , `card_number` , `card_type` , `card_date` , `card_cvc` , `transacknum`,`pay_flag`, `date` )
        VALUES (
        '$uid', '$promoter_id', '$country_id', '$cost', '$user_street', '$user_city', '$user_state', '$user_zip', '$user_country', '$cart_info', '$pay_type', '$card_name', '$card_number', '$card_type', '$card_date', '$card_cvc', '0', '-1', '$timestamp'
        )";
$db->query($sql);
$orderid = $db->insert_id();

// =========================== ֧Ϣ start =========================================

$paymentBOX['baseURL']			= 'https://betaling.wannafind.dk/';
$paymentBOX['proxyURL']			= $paymentBOX['baseURL'].'proxy/p.php/';
$paymentBOX['authURL']			= $paymentBOX['baseURL'].'auth.php';

$paymentBOX['accepturl']		= $paymentBOX['proxyURL'].'http://'.$paymentBOX['mydomain'].$paymentBOX['path'] .'pay_approved.php';
$paymentBOX['declineurl']		= $paymentBOX['proxyURL'].'http://'.$paymentBOX['mydomain'].$paymentBOX['path'] .'pay_declined.php';


$paymentBOX['shopid'] 			= '2006041972071';
$paymentBOX['currency'] 		= 208;
$paymentBOX['amount']			= round($cost*100);
$paymentBOX['orderid']			= $orderid;
$paymentBOX['orderidprefix']	= '';
$paymentBOX['paytype']			= $pay_type;
$paymentBOX['uniqorderid']		= 'false';

$key							= 'KeyJsnw2830022';
$md5sum 						= md5($paymentBOX['amount'].$paymentBOX['orderid'].$paymentBOX['currency'].$key);

$paymentBOX['checkmd5']			= $md5sum;

// =========================== ֧Ϣ end ===========================================


// ת֧ƽ̨

require_once PrintEot('jump_pay2');

?>